﻿using sixgod.Enum;
using SqlSugar;

namespace sixgod.Model.WorkFlowTemplate
{
    /// <summary>w 
    /// 流程节点
    /// </summary>
    [SugarTable("WorkFlowTemplateNode")]
    public class WorkFlowTemplateNode:ModelBase
    {
        /// <summary>
        /// 节点名称
        /// </summary>
        public string Name { get; set; }

        // 表单信息 审核模式（一过既过，全过才过） 节点类型（审核、抄送、开始、结束）
        /// <summary>
        /// 模板ID
        /// </summary>
        public string TemplateId { get; set; }

        /// <summary>
        /// 节点类型
        /// </summary>
        public EnumNodeType EnumNodeType { get; set; }

        /// <summary>
        /// 审核模式
        /// </summary>
        public EnumAuditMode EnumAuditMode{get;set; }

        /// <summary>
        /// 是否自动部门领导
        /// </summary>
        public bool AddDepartmentLeader { get; set; }

        /// <summary>
        /// 是否自动职位上级
        /// </summary>
        public bool AddJobLeader { get; set; }

        /// <summary>
        /// 提示方式，字典
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string? HintMethod { get; set; }

        /// <summary>
        /// 一人通过即通过的模式下是否抄送其他审核人
        /// </summary>
        public bool? SendOther{get;set; }

        /// <summary>
        /// 拒绝后的操作
        /// 1.回退  2.结束流程
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string? RejectOperation { get; set; }


        /// <summary>
        /// 模型数据验证
        /// </summary>
        /// <returns></returns>
        public override (bool, string) Verify()
        {
            return (false, null);
        }

        public void StartNodeInit(string creater, string templateId)
        {
            base.Create(creater);
            Name = "开始";
            EnumNodeType = EnumNodeType.Start;
            AddDepartmentLeader = false;
            AddJobLeader = false;
            TemplateId = templateId;
            SendOther = false;
            EnumAuditMode = EnumAuditMode.All;
            HintMethod = null;
        }
    }
}
